import { _decorator, Component, tween, UIOpacity } from 'cc';
const { ccclass, property } = _decorator;


/** 自动隐藏组件 */
@ccclass('AutoHide')
export class AutoHide extends Component {
    private op: UIOpacity = null;
    onLoad() {
        this.op = this.node.getComponent(UIOpacity);
        this.op.opacity = 0;
    }
    onEnable() {
        tween(this.op)
            .to(0.1, { opacity: 255 })
            .delay(0.25)
            .to(0.1, { opacity: 0 })
            .call(() => { this.node.active = false })
            .start();
    }
}


